#include<iostream>
#include<vector>
using namespace std;
typedef long long LL;
const int N = 1e5 + 10;
int n, m, x;
int main()
{
	cin >> n >> m >> x;
	vector<vector<int>>g(n, vector<int>(m));
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			int v;
			cin >> v;
			g[i].push_back(v);
		}
	}
	LL cnt = 0;
	for (int i = 0; i < n - 1; i++) {
		for(auto j:g[i]) {
			//cout << "g[i][j]==" << g[i][j] << endl;
			if ((g[i][j] ^ g[i][j + 1] ^ g[i + 1][j] ^ g[i + 1][j + 1]) == x) {
				cnt++;	
			}
		}
	}
	cout << cnt << endl;
	return 0;
}